-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add whitelistHosts option. #1451
Conversation
## if we have white listed hosts | ||
if wlh = config.whitelistHosts | ||
## and url does not match any of our whitelisted hosts | ||
if not matched = blacklist.matches(req.proxiedUrl, wlh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused by the comment and whitelist / blacklist combination here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whitelist is being passed in to this function as wlh
, this is just a (now badly named) function. blacklist
(the library) is now more a *list
-matching library after these changes so presumably should be renamed.
@dracos I think the logic between white listed hosts and black listed should be expressed very clearly, also you can run unit tests to see them fail (as they are failing on CI)
|
As gleb mentioned, some of the tests are failing. We also need tests to cover the Let us know if you have trouble getting the tests running locally. |
Also beyond unit tests, we must have e2e tests to cover this config option. You can take the existing blacklist e2e tests and repurpose them. |
Have renamed library to hostlist, added unit and e2e tests that pass locally. Don't think the failure there now is in anything I've touched. |
Right that failure is not related. |
Any updates on this? A project I'm working on makes calls to a lot of external URLs and our blacklist is very long (and when new endpoints are added we have to remember to add them). |
# Conflicts: # packages/server/lib/config.coffee # packages/server/lib/controllers/proxy.coffee
This is something that can be accomplished once #687 is added. Here is one example of how: function whitelistMatches(url) {
// ...
}
cy.route('*', (req) => {
if (!whitelistMatches(req.url)) {
return req.destroy()
}
req.reply()
})
|
For #1443